<script language="javascript">

$(document).ready(function() {ldelim}
	
	$("form[name='new_variant']").submit(function() {ldelim}
		var url = $(this).attr('action');
		var data = $(this).serialize();	
			execute('', '', 'Свойство добавлено', url, '', data, function(){ldelim}updateHash('tab3-4tab'); setupHash('widget2');{rdelim});
		return false;
	{rdelim});


$("form[name='edit_variant']").submit(function() {ldelim}
	var url = $(this).attr('action');
	var data = $(this).serialize();	
		execute('', '', 'Свойства отредактированы', url, '', data, function(){ldelim}updateHash('tab3-4tab'); setupHash('widget2');{rdelim});
	return false;
{rdelim});






{rdelim});
</script>
<br/>
<h4>Дополнительные свойства категорий</h4>
<br/>
{if $variantCateg}
<form name="edit_variant" action="index.php?do=modules&action=modedit&mod=shop&moduleaction=variant_category&cp={$sess}&sub=save" method="post" class="mainForm">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<thead>
  <tr>
    <td width="150">{#CatName#}</td>
    <td width="150">вин падеж</td>
    <td>{#CatIn#}</td>
    <td></td>
    <td>1 <a href="javascript:void(0);" class="topleftDir" title="Данное поле обязательно к заполнению при поиске?">[?]</a></td>
    <td>2 <a href="javascript:void(0);" class="topleftDir" title="Данное поле - это диапазон?">[?]</a></td>
    <td>3 <a href="javascript:void(0);" class="topleftDir" title="Данное поле - участвует в поиске?">[?]</a></td>
    <td>4 <a href="javascript:void(0);" class="topleftDir" title="Показывать данное поле в общем выводе товаров?">[?]</a></td>
    <td>5 <a href="javascript:void(0);" class="topleftDir" title="Показывать данное поле в детальном выводе товара?">[?]</a></td>
    <td>6 <a href="javascript:void(0);" class="topleftDir" title="Данное свойство активно?">[?]</a></td>
    <td>7 <a href="javascript:void(0);" class="topleftDir" title="Порядок вывода">[?]</a></td>
	<td colspan="1"></td>
    </tr>
</thead>
	{foreach from=$variantCateg item=ss}
		<tr class="variantCateg_{$ss->Id}">
			<td class="level{$ss->prefix}"><input style="width:{if $ss->prefix !=1}122px{else}140px{/if}" type="text" name="variant_name[{$ss->Id}]" value="{$ss->variant_name|stripslashes}"></td>
			
			<td><input style="width:100px" type="text" name="variant_name_dop[{$ss->Id}]" value="{$ss->variant_name_dop|stripslashes}"></td>
			{if $ss->prefix == '1'}
			<td width="100">
				<select style="width:150px" name="variant_product_category[{$ss->Id}]">
				{foreach from=$ProductCategs item=pc}
				<option value="{$pc->Id}" {if $pc->Id==$ss->variant_product_category} selected="selected"{/if}>{$pc->expander}{$pc->category_name|escape:html|stripslashes}</option>
				{/foreach}
				</select>
			</td>
			{else}
			<td width="100">
				{foreach from=$ProductCategs item=pc}
					{if $pc->Id==$ss->variant_product_category}
						{$pc->category_name|escape:html|stripslashes}
					{/if}
				{/foreach}	

				<input type="hidden" value="{$ss->variant_product_category}" name="variant_product_category[{$ss->Id}]">
				<input type="hidden" value="{$ss->Id}" name="variant_parent[{$ss->Id}]">
					
			</td>
			{/if}
			<td width="50">{if $ss->prefix ==1}<input title="{#NAVI_ADD_SUBITEM#}" type="button" class="basicBtn topDir" onclick="document.getElementById('Neu_2_{$ss->Id}').style.display='';" value="+" />{/if}</td>
			
			<td width="120" nowrap>
				<input name="variant_stop[{$ss->Id}]" type="checkbox" id="variant_stop[{$ss->Id}]" value="1" {if $ss->variant_stop=='1'}checked="checked" {/if}/>
			</td>
			
			<td width="120" nowrap>
				<input name="variant_range[{$ss->Id}]" type="checkbox" id="variant_range[{$ss->Id}]" value="1" {if $ss->variant_range=='1'}checked="checked" {/if}/>
			</td>
			
			<td width="120" nowrap>
				<input name="variant_search_small[{$ss->Id}]" type="checkbox" id="variant_search_small[{$ss->Id}]" value="1" {if $ss->variant_search_small=='1'}checked="checked" {/if}/>	
			</td>
			
			<td width="120" nowrap>
				<input name="variant_item_small[{$ss->Id}]" type="checkbox" id="variant_item_small[{$ss->Id}]" value="1" {if $ss->variant_item_small=='1'}checked="checked" {/if}/>	
			</td>
			
			<td width="120" nowrap>
				<input name="variant_item_detail[{$ss->Id}]" type="checkbox" id="variant_item_detail[{$ss->Id}]" value="1" {if $ss->variant_item_detail=='1'}checked="checked" {/if}/>	
			</td>
			
			<td width="120" nowrap>
				<input name="variant_active[{$ss->Id}]" type="checkbox" id="variant_active[{$ss->Id}]" value="1" {if $ss->variant_active=='1'}checked="checked" {/if}/>
			</td>
			<td><input style="width:20px" type="text" name="variant_sort[{$ss->Id}]" value="{$ss->variant_sort|stripslashes}"></td>


			<td>

				<a class="topleftDir icon_sprite ico_delete" href="javascript:void(0);" onclick="execute('Удалить свойство?', 'Удаление свойства категории безвозвратно и удаляется у всех товаров, будьте внимательнее.', 'Свойство удалено', 'index.php?do=modules&action=modedit&mod=shop&moduleaction=variant_category&Id={$ss->Id}&sub=del&cp={$sess}', '.variantCateg_{$ss->Id}');" title="Удалить свойство"></a>
				
			</td>
		</tr>
		
		
			<tr id="Neu_2_{$ss->Id}" style="display:none;" class="variantCateg_{$ss->variant_parent}">

				<td class="level2"><input style="width:120px" type="text" name="variant_name_Neu_2[{$ss->Id}]" value=""></td>
				
				<td><input style="width:100px" type="text" name="variant_name_dop_Neu_2[{$ss->Id}]" value=""></td>
				
				<td><input type="hidden" value="{$ss->variant_product_category}" name="variant_product_category_Neu_2[{$ss->Id}]"></td>
				
				<td></td>
				
				<td>
					<input name="variant_stop_Neu_2[{$ss->Id}]" type="checkbox" id="variant_stop_Neu_2[{$ss->Id}]" value="1" />
				</td>
				
				<td>
					<input name="variant_range_Neu_2[{$ss->Id}]" type="checkbox" id="variant_range_Neu_2[{$ss->Id}]" value="1" />
				</td>
				
				<td>
					<input name="variant_search_small_Neu_2[{$ss->Id}]" type="checkbox" id="variant_search_small_Neu_2[{$ss->Id}]" value="1" />
				</td>
				
				<td>
					<input name="variant_item_small_Neu_2[{$ss->Id}]" type="checkbox" id="variant_item_small_Neu_2[{$ss->Id}]" value="1" />	
				</td>
				
				<td>
					<input name="variant_item_detail_Neu_2[{$ss->Id}]" type="checkbox" id="variant_item_detail_Neu_2[{$ss->Id}]" value="1" />	
				</td>
				
				<td>
					<input name="variant_active_Neu_2[{$ss->Id}]" type="checkbox" id="variant_active_Neu_2[{$ss->Id}]" value="1" />
				</td>
				<td>
					<input style="width:20px" type="text" name="variant_sort_Neu_2[{$ss->Id}]" id="variant_sort_Neu_2[{$ss->Id}]" value=""></td>
				<td>

				
					
				</td>
			
			</tr>	

	{*		
		{foreach from=$ss->ebene_2 item=ss2}
			<tr class="variantCateg_{$ss2->variant_parent}">
				
				<td class="level2"><input style="width:120px" type="text" name="variant_name[{$ss2->Id}]" value="{$ss2->variant_name|stripslashes}"></td>
				
				<td><input style="width:100px" type="text" name="variant_name_dop[{$ss2->Id}]" value="{$ss2->variant_name_dop|stripslashes}"></td>
				
				<td width="100">
					{foreach from=$ProductCategs item=pc}
						{if $pc->Id==$ss2->KatId}
							{$pc->category_name|escape:html|stripslashes}
						{/if}
					{/foreach}
				</td>
				
				<td></td>
				
				<td>
					<input name="variant_stop[{$ss2->Id}]" type="checkbox" id="variant_stop[{$ss2->Id}]" value="1" {if $ss2->variant_stop=='1'} checked="checked"{/if}/>
				</td>
				
				<td>
					<input name="variant_range[{$ss2->Id}]" type="checkbox" id="variant_range[{$ss2->Id}]" value="1" {if $ss2->variant_range=='1'} checked="checked"{/if}/>
				</td>
				
				<td>
					<input name="variant_search_small[{$ss2->Id}]" type="checkbox" id="variant_search_small[{$ss2->Id}]" value="1" {if $ss2->variant_search_small=='1'} checked="checked"{/if}/>
				</td>
				
				<td>
					<input name="variant_item_small[{$ss2->Id}]" type="checkbox" id="variant_item_small[{$ss2->Id}]" value="1" {if $ss2->variant_item_small=='1'} checked="checked"{/if}/>	
				</td>
				
				<td>
					<input name="variant_item_detail[{$ss2->Id}]" type="checkbox" id="variant_item_detail[{$ss2->Id}]" value="1" {if $ss2->variant_item_detail=='1'} checked="checked"{/if}/>	
				</td>
								
				<td>
					<input name="variant_active[{$ss2->Id}]" type="checkbox" id="variant_active[{$ss2->Id}]" value="1" {if $ss2->variant_active=='1'} checked="checked"{/if}/>
				</td>
				
				<td>
					<input style="width:20px" type="text" name="variant_sort[{$ss2->Id}]" value="{$ss2->variant_sort|stripslashes}"></td>
				<td>
					delete	
				</td>
				
				

			</tr>
		{/foreach}	
	*}	
	{/foreach}
	
	
	
	
	
	
	
 </table>
<div class="rowElem">
 <input type="submit" class="basicBtn topDir" value="{#ButtonSave#}">
 </div>
</form>


{else}
		<ul class="messages">
			<li class="highlight yellow">Дополнительные свойства у категорий не заданы</li>
		</ul>
{/if}


<br/><br/>

<h4>Добавить новое свойство</h4>
<br/>
<form method="post" name="new_variant" action="index.php?do=modules&action=modedit&mod=shop&moduleaction=variant_category&sub=new&cp={$sess}" class="mainForm">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
{*
<thead>
  <tr>
    <td>Название свойства</td>
    <td width="160">Название свойства в винительном падеже</td>
    <td>{#CatIn#}</td>
  </tr>
</thead>
*}
  <tr>

	 <td width="250">
		 <input style="width:250px" type="text" name="variant_name" value="" placeholder="Название свойства">
	 </td>
	 
	 <td style="width:1%">
	 	<input style="width:250px" type="text" name="variant_name_dop" placeholder="Название свойства в винительном падеже">
	 </td>
	 
	 <td>
		<select style="width:250px" name="variant_product_category">
		{foreach from=$ProductCategs item=pc}
		<option value="{$pc->Id}">{$pc->expander}{$pc->category_name|escape:html|stripslashes}</option>
		{/foreach}
		</select>
	 	
	 </td>
 
 </tr>

</table>
<div class="rowElem">
	<input type="submit" class="basicBtn topDir" value="{#ButtonSave#}" />
</div>

</form>
 <br />